package Test1;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        //1.创建集合,存储学生对象
        ArrayList<Student>list=new ArrayList<>();

        //2.创建学生对象
        Student stu1=new Student("zhangsan",24,"男");
        Student stu2=new Student("lisi",24,"女");
        Student stu3=new Student("wangwu",25,"男");

        //3.将学生对象存储到集合中
        list.add(stu1);
        list.add(stu2);
        list.add(stu3);

        //4.方法的调用
        int maxAge=StudentUtil.getMaxAgeStudents(list);
        System.out.println("最大年龄为"+maxAge);
    }
}
